package com.qf.sys.service.impl;

import com.github.pagehelper.PageInfo;
import com.qf.sys.dao.DeptDao;
import com.qf.sys.po.Dept;
import com.qf.sys.service.DeptService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * @创建人 sunsir Email:sunsir163@163.com
 * @创建时间 2022/5/7
 * @描述
 */
@Service
public class DeptServiceImpl implements DeptService {
    @Resource
    DeptDao deptDao;

    public Dept getDeptById(Integer id) {
        return deptDao.getDeptById(id);
    }


    public PageInfo<Dept> getDeptList(Map params) {
        List<Dept> deptList= deptDao.getDeptList(params);
        PageInfo<Dept> pageInfo = new PageInfo<Dept>(deptList);
        return pageInfo;
    }


    public boolean addDept(Map params) {
        boolean f=deptDao.addDept(params) > 0?true:false;
        return f;
    }


    public boolean updateDept(Map params) {
        return deptDao.updateDept(params) > 0;
    }


    public boolean deleteDept(int id) {
        return deptDao.deleteDept(id) > 0;
    }

    public List<Dept> selectDeptList() {
        List<Dept> deptList = deptDao.selectDeptList();
        System.out.println(deptList);
        return deptList;
    }

    @Override
    public boolean upadteDeptstatusTo0(int deptNo) {
        return deptDao.upadteDeptstatusTo0(deptNo);
    }

    @Override
    public boolean upadteDeptstatusTo1(int deptNo) {
        return deptDao.upadteDeptstatusTo1(deptNo);
    }
}
